vector calculus for gate preparation